package com.ctshk.sapp.order.hotel.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.hotel.service.IHotelOrderRefundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 酒单退款记录 前端控制器
 * </p>
 *
 * @author yinhuan
 * @since 2021-03-08
 */
@Api(value = "酒店退款",tags = "酒店退款")
@RestController
@RequestMapping("/hotel/order/refund")
public class HotelOrderRefundController extends BaseController {
    @DubboReference
    IHotelOrderRefundService hotelOrderRefundService;

    @ApiOperation(value = "订单中心酒店退款记录-操作退款", notes = "订单中心酒店退款记录-操作退款")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.UPDATE, operTitle = "订单中心酒店退款记录-操作退款", operDesc = "订单中心酒店退款记录-操作退款")
    @GetMapping(value = "/refund/{refundId}")
    public Result refund(@PathVariable Long refundId){
        return hotelOrderRefundService.refund(refundId,getCurrentUser(getRequest()).getId());
    }

    @ApiOperation(value = "订单中心酒店退款记录-删除", notes = "订单中心酒店退款记录-删除")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.UPDATE, operTitle = "订单中心酒店退款记录-删除", operDesc = "订单中心酒店退款记录-删除")
    @GetMapping(value = "/delete/{refundId}")
    public Result delete(@PathVariable Long refundId){
        return hotelOrderRefundService.delete(refundId,getCurrentUser(getRequest()).getId());
    }
}
